package xyz.xuminghai.javafx_learn.scene.control;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextInputDialog;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

/**
 * 2023/5/24 2:14 星期三<br/>
 * 文本输入对话框
 *
 * @author xuMingHai
 */
public class TextInputDialogApp extends Application {

    private final VBox vBox = new VBox(30.0);

    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void init() {

        Button button = new Button("对话框");
        button.setOnAction(event -> {
            TextInputDialog textInputDialog = new TextInputDialog("xxx");
            textInputDialog.show();
        });

        vBox.getChildren().add(button);
        vBox.setAlignment(Pos.CENTER);
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle(getClass().getSimpleName());
        Scene scene = new Scene(vBox, 800, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

}
